<?php

/**
 *  Ham goi mailer
 * 
 * */
if (!function_exists('mailer'))
{
    function mailer($isSMTP = false,$SMTPAuth = false,$SMTPSecure = "",$host = "localhost",$port = 25,$username = "",$password = "")
    {
        $mail = new Utilities_Phpmailer(true);
        if(! $isSMTP)
             return $mail;
        $mail->CharSet = 'utf-8';
        $mail->IsSMTP();
        $mail->SMTPAuth   = $SMTPAuth;        
      	$mail->SMTPSecure = $SMTPSecure;          
     	$mail->Host       = $host;
     	$mail->Port       = $port;             
      	$mail->Username   = $username;
      	$mail->Password   = $password;
      
      	return $mail;  
    }
}